home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Pascal / Games / Glypha II 1.21 / source / Code ƒ / B-AboutWndo.p < prev    next >
Encoding:
Text File  |  1993-07-01  |  3.3 KB  |  118 lines  |  [TEXT/PJMM]

  1. unit AboutWndo;
  2.  
  3. interface
  4.     uses
  5.         Palettes, Sound, Globals;
  6.  
  7.     procedure AboutUs;
  8.     procedure CloseLogoWindo;
  9.     procedure OpenLogoWindo (rightOff, downOff: Integer);
  10.  
  11. implementation
  12.  
  13.     var
  14.         ExitDialog: boolean;            {Flag used to exit the Dialog    }
  15.         logoWindo: WindowPtr;            {Ptr to Soft Dorothy logo    }
  16.         tempRect: Rect;
  17.         Pic_Handle: PicHandle;
  18.  
  19. {============================================}
  20.  
  21.     procedure AboutUs;
  22.         const                        {These are the item numbers for controls in the Dialog    }
  23.             I_Okay = 1;        {They are all found in the .RSRC file                            }
  24.  
  25.         var
  26.             GetSelection: DialogPtr;                {Name of dialog    }
  27.             tempRect: Rect;                                    {Temporary rectangle}
  28.             DType, itemHit: Integer;
  29.             DItem: Handle;                                    {Handle to the dialog item}
  30.             CItem, CTempItem: controlhandle;{Control handle}
  31.  
  32.             dummyInt: Integer;
  33.             dialHandle: DialogTHndl;
  34.             dialRect: Rect;
  35.  
  36. {--------------------}
  37.  
  38.         procedure Refresh_Dialog;        {Refresh the dialogs non-controls    }
  39.         begin
  40.             SetPort(GetSelection);
  41.             GetDItem(GetSelection, I_Okay, DType, DItem, tempRect);
  42.             PenSize(3, 3);
  43.             InsetRect(tempRect, -4, -4);
  44.             FrameRoundRect(tempRect, 16, 16);
  45.             PenSize(1, 1);
  46.         end;
  47.  
  48. {--------------------}
  49.  
  50.     begin
  51.         dialHandle := DialogTHndl(Get1Resource('DLOG', aboutDialID));
  52.         if (dialHandle <> nil) then
  53.             begin
  54.                 HNoPurge(Handle(dialHandle));
  55.                 dialRect := dialHandle^^.boundsRect;
  56.                 OffsetRect(dialRect, -dialRect.left, -dialRect.top);
  57.                 dummyInt := (screenBits.bounds.right - dialRect.right) div 2;
  58.                 OffsetRect(dialRect, dummyInt, 0);
  59.                 dummyInt := (screenBits.bounds.bottom - dialRect.bottom) div 3;
  60.                 OffsetRect(dialRect, 0, dummyInt);
  61.                 dialHandle^^.boundsRect := dialRect;
  62.                 HPurge(Handle(dialHandle));
  63.             end;
  64.  
  65.         GetSelection := GetNewDialog(aboutDialID, nil, Pointer(-1));    {Get dialog from rsrc    }
  66.  
  67.         ShowWindow(GetSelection);
  68.         SelectWindow(GetSelection);
  69.         SetPort(GetSelection);
  70.         Refresh_Dialog;
  71.         ExitDialog := FALSE;                    {Do not exit dialog yet        }
  72.         repeat
  73.             ModalDialog(nil, itemHit);    {Wait until an item is hit    }
  74.             GetDItem(GetSelection, itemHit, DType, DItem, tempRect); {Get info    }
  75.             CItem := Pointer(DItem);        {Get the control handle        }
  76.             if (ItemHit = I_Okay) then    {Handle Button being pressed    }
  77.                 begin
  78.                     ExitDialog := TRUE;            {Exit when this is made        }
  79.                     Refresh_Dialog;
  80.                 end;
  81.         until ExitDialog;                            {Do items til OKAY selected    }
  82.         DisposDialog(GetSelection);        {Flush dialog out of memory    }
  83.     end;
  84.  
  85. {=================================}
  86.  
  87.     procedure CloseLogoWindo;
  88.     begin
  89.         DisposeWindow(GrafPtr(logoWindo));
  90.         logoWindo := nil;
  91.     end;
  92.  
  93. {=================================}
  94.  
  95.     procedure OpenLogoWindo;
  96.         var
  97.             tempRect: Rect;
  98.     begin
  99.         logoWindo := nil;
  100.         logoWindo := GetNewCWindow(1999, nil, Pointer(-1));
  101.         SetRect(tempRect, 0, 0, 325, 318);
  102.         SelectWindow(GrafPtr(logoWindo));
  103.         SetPort(GrafPtr(logoWindo));
  104.         ShowWindow(GrafPtr(logoWindo));
  105.         Pic_Handle := GetPicture(1999);                    {Get PICT (ID=1999) from .RSRC fork}
  106.         if (Pic_Handle <> nil) then                        {If the PICT (ID=1999) exists then.}
  107.             begin
  108.                 HLock(Handle(Pic_Handle));
  109.                 tempRect := Pic_Handle^^.picFrame;
  110.                 DrawPicture(Pic_Handle, tempRect);
  111.                 HUnLock(Handle(Pic_Handle));
  112.                 ReleaseResource(Handle(Pic_Handle));{Dump PICT from RAM}
  113.             end;
  114.     end;
  115.  
  116. {=================================}
  117.  
  118. end.                                    {End of unit}